import java.util.Scanner;

public class Main {
    static int n,k,ret,sum;
    static int[][] m;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        k = scanner.nextInt();
        m = new int[4][k];
        dfs(4);
        System.out.println(ret);
    }
    public static void dfs(int u) {
        if(u == 4) {
            if(sum == k) ret++;
            return;
        }
        if(u < 2) {
            for(int i = 1; i<=n; i++) {
                sum += i;
                dfs(u+1);
                sum -= i;
            }
        }else {
            for(int i = 1; i<=n; i++) {
                sum -= i;
                dfs(u+1);
                sum += i;
            }
        }
    }
}

/*

m[i][j]: 第i轮时, 金币数量为j的解法种数

 */
